import java.lang.reflect.Method;

public class ParseAnno {
  public static void main(String[] args) {
		try {
			// 1.使用类加载器加载类
			Class c = Class.forName("Anno");
			// 2.找到类上面的注解
			boolean isExit = c.isAnnotationPresent(Description.class);
			if (isExit) {
				// 3.拿到注解上的实例
				Description d = (Description) c
						.getAnnotation(Description.class);
				System.out.println(d.value());
			}
			// 4.方法的注解
			Method[] ms = c.getMethods();
			for (Method m : ms) {
				boolean isMExit = m.isAnnotationPresent(Description.class);
				if (isMExit) {
					Description d = (Description) m.getAnnotation(Description.class);
					System.out.println(d.value());
				}
			}

		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}

	}
}
